# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=semgrep
pkgver=1.144.0
pkgrel=2
epoch=1
pkgdesc='Lightweight static analysis for many languages.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-code-audit')
url='https://pypi.org/project/semgrep/'
license=('LGPL-2.0-only')
depends=('python' 'python-virtualenv')
makedepends=('python-build' 'python-pip' 'python-wheel')
replaces=('python-semgrep')
install="$pkgname.install"

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
source /usr/share/$pkgname/venv/bin/activate
exec /usr/share/$pkgname/venv/bin/$pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

